package com.jms.boot.context;

import com.jms.framework.jdbc.context.AbstractJDBCContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class JmsBootJDBCContext extends AbstractJDBCContext {
    private volatile static JmsBootJDBCContext instance;

    private static final Logger logger = LogManager.getLogger(JmsBootJDBCContext.class);

    private JmsBootJDBCContext() {
        super();
    }

    public static JmsBootJDBCContext getInstance() {
        if (instance == null) {
            synchronized (JmsBootJDBCContext.class) {
                if (instance == null) {
                    instance = new JmsBootJDBCContext();
                }
            }
        }
        return instance;
    }

    @Override
    public void init() {
        logger.info("JmsBoot JDBC context starts initializing.");
        super.init();
        logger.info("JmsBoot JDBC context initialization is complete.");
    }

    @Override
    public void destroy() {
        logger.info("JmsBoot JDBC context starts destroying.");
        super.destroy();
        logger.info("JmsBoot JDBC context destruction is complete.");
    }
}
